package priv.mill.view;

import java.awt.BorderLayout;
import java.awt.EventQueue;

import javax.swing.JFrame;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.border.EmptyBorder;
import javax.swing.JLayeredPane;

import java.awt.Color;

import javax.swing.JTextField;
import javax.swing.JButton;

import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;

import javax.swing.JLabel;
import javax.swing.ImageIcon;

import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;

public class LoginView extends JFrame {

	private JPanel contentPane;
	private JTextField textField;

	/**
	 * Launch the application.
	 */
	public static void main(String[] args) {
		EventQueue.invokeLater(new Runnable() {
			public void run() {
				try {
					LoginView frame = new LoginView();
					frame.setVisible(true);
				} catch (Exception e) {
					e.printStackTrace();
				}
			}
		});
	}

	/**
	 * Create the frame.
	 */
	public LoginView() {
		setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		setBounds(100, 100, 532, 379);
		contentPane = new JPanel();
		contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
		contentPane.setLayout(new BorderLayout(0, 0));
		setContentPane(contentPane);
		
		JLayeredPane layeredPane = new JLayeredPane();
		contentPane.add(layeredPane, BorderLayout.CENTER);
		
		JPanel Yelloceng = new JPanel();
		Yelloceng.setBackground(Color.ORANGE);
		Yelloceng.setBounds(10, 10, 464, 303);
		layeredPane.add(Yelloceng);
		Yelloceng.setLayout(null);
		
		textField = new JTextField();
		textField.setBounds(75, 76, 200, 50);
		Yelloceng.add(textField);
		textField.setColumns(10);
		
		JButton button = new JButton("\u5230\u7070\u8272\u66FE");
		button.setBounds(0, 0, 95, 25);
		Yelloceng.add(button);
		
		JPanel grayCeng = new LimaoJPanel(layeredPane);
		layeredPane.setLayer(grayCeng, 5);
		grayCeng.setBackground(Color.GRAY);
		grayCeng.setBounds(0, 0, 476, 313);
		layeredPane.add(grayCeng);
		grayCeng.setLayout(null);
		
		button.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				layeredPane.setLayer(grayCeng, 5);
				layeredPane.setLayer(Yelloceng, 1);
			}
		});
		JButton btnNewButton = new JButton("\u5230\u9EC4\u8272\u66FE");
		btnNewButton.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				layeredPane.setLayer(grayCeng, 1);
				layeredPane.setLayer(Yelloceng, 5);
			}
		});
		btnNewButton.setBounds(134, 129, 95, 25);
		grayCeng.add(btnNewButton);
		
		JLabel lblNewLabel = new JLabel("");
		lblNewLabel.addMouseListener(new MouseAdapter() {
			@Override
			public void mouseClicked(MouseEvent e) {
				JOptionPane.showMessageDialog(null, "aaaaa");
			}
		});
		String filename = "D:\\Documents\\Pictures\\a701su2093595565650.jpg";
		ImageIcon icon = new ImageIcon(filename);
		lblNewLabel.setIcon(icon);
		lblNewLabel.setBounds(10, 21, 135, 106);
		grayCeng.add(lblNewLabel);
	}
}
